/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nus.dataaccess.dao.review;

import com.nus.dataaccess.dao.base.BaseEntity;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author robin.foe
 */

@Entity
@Table(name="REVIEW_RESULT")
public class ReviewResult extends BaseEntity{
    
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private Long id;
    public Long getId() {return id;}
    public void setId(Long id) {this.id = id;}
    @Override
    public Serializable getPk() {return this.getId();}
    
    @Column(name="QR_MARK_01")
    private Integer qrMark01 = 0;
    public Integer getQrMark01() {return qrMark01;}
    public void setQrMark01(Integer qrMark01) {this.qrMark01 = qrMark01;}
    
    @Column(name="QR_MARK_02")
    private Integer qrMark02 = 0;
    public Integer getQrMark02() {return qrMark02;}
    public void setQrMark02(Integer qrMark02) {this.qrMark02 = qrMark02;}
    
    @Column(name="QR_MARK_03")
    private Integer qrMark03 = 0;
    public Integer getQrMark03() {return qrMark03;}
    public void setQrMark03(Integer qrMark03) {this.qrMark03 = qrMark03;}
    
    @Column(name="QR_MARK_04")
    private Integer qrMark04 = 0;
    public Integer getQrMark04() {return qrMark04;}
    public void setQrMark04(Integer qrMark04) {this.qrMark04 = qrMark04;}
    
    @Column(name="QR_MARK_05")
    private Integer qrMark05 = 0;
    public Integer getQrMark05() {return qrMark05;}
    public void setQrMark05(Integer qrMark05) {this.qrMark05 = qrMark05;}
    
    @Column(name="EV_MARK_01")
    private Integer evMark01 = 0;
    public Integer getEvMark01() {return evMark01;}
    public void setEvMark01(Integer evMark01) {this.evMark01 = evMark01;}
    
    @Column(name="EV_MARK_02")
    private Integer evMark02 = 0;
    public Integer getEvMark02() {return evMark02;}
    public void setEvMark02(Integer evMark02) {this.evMark02 = evMark02;}
    
    @Column(name="EV_MARK_03")
    private Integer evMark03 = 0;
    public Integer getEvMark03() {return evMark03;}
    public void setEvMark03(Integer evMark03) {this.evMark03 = evMark03;}
    
    @Column(name="EV_MARK_04")
    private Integer evMark04 = 0;
    public Integer getEvMark04() {return evMark04;}
    public void setEvMark04(Integer evMark04) {this.evMark04 = evMark04;}
    
    @Column(name="QW_MARK_01")
    private Integer qwMark01 = 0;
    public Integer getQwMark01() {return qwMark01;}
    public void setQwMark01(Integer qwMark01) {this.qwMark01 = qwMark01;}
    
    @Column(name="QW_MARK_02")
    private Integer qwMark02 = 0;
    public Integer getQwMark02() {return qwMark02;}
    public void setQwMark02(Integer qwMark02) {this.qwMark02 = qwMark02;}
    
    @Column(name="REMARK_01")
    private String remark01;
    public String getRemark01() {return remark01;}
    public void setRemark01(String remark01) {this.remark01 = remark01;}
    
    @Column(name="REMARK_02")
    private String remark02;
    public String getRemark02() {return remark02;}
    public void setRemark02(String remark02) {this.remark02 = remark02;}
    
    @Column(name="REVIEW_ASSIGNMENT_ID")
    private Long reviewAssignmentId;
    public Long getReviewAssignmentId() {return reviewAssignmentId;}
    public void setReviewAssignmentId(Long reviewAssignmentId) {this.reviewAssignmentId = reviewAssignmentId;}
    
    @ManyToOne
    @JoinColumn(name="REVIEW_ASSIGNMENT_ID", referencedColumnName="ID",insertable=false,updatable=false)
    private ReviewAssignment reviewAssignment;
    public ReviewAssignment getReviewAssignment() {return reviewAssignment;}
    public void setReviewAssignment(ReviewAssignment reviewAssignment) {
        this.reviewAssignment = reviewAssignment;
        this.setReviewAssignmentId(( reviewAssignment == null ) ? null : reviewAssignment.getId());
    }
    
    /******************** UTILITY ****************************/
    public int getTotalQrScore(){
        return qrMark01 + qrMark02 + qrMark03 + qrMark04 + qrMark05;
    }
    
    public int getTotalEvScore(){
        return evMark01 + evMark02 + evMark03 + evMark04;
    }
    
    public int getTotalQwScore(){
        return qwMark01 + qwMark02;
    }
    
    public int getTotalScore(){
        return this.getTotalQrScore() + this.getTotalEvScore() + this.getTotalQwScore();
    }
    
    
}
